package com.atjinggu.jinggumail.product.entity;

import com.atjinggu.jinggumail.common.valid.AddGroup;
import com.atjinggu.jinggumail.common.valid.ListVal;
import com.atjinggu.jinggumail.common.valid.UpdateGroup;
import com.atjinggu.jinggumail.common.valid.UpdateStatusGroup;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;

import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author jingming
 * @email jingming@gmail.com
 * @date 2020-12-12 23:08:28
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@NotBlank(message = "修改品牌时，品牌Id不能为空",groups = {UpdateGroup.class,UpdateStatusGroup.class})
	@Null(message="新增品牌时，品牌Id必须为空",groups ={AddGroup.class})
	@TableId
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名称不能为空",groups = {AddGroup.class})
	private String name;
	/**
	 * 品牌logo地址
	 */
	@NotBlank(message = "品牌地址不能为空",groups = {AddGroup.class})
	@URL(message = "品牌logo地址必须符合url规范",groups = {AddGroup.class, UpdateGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@ListVal(vals={0,1},groups = {UpdateStatusGroup.class,AddGroup.class,UpdateGroup.class})
	@NotNull(message = "显示状态不能为空",groups = {AddGroup.class, UpdateStatusGroup.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@NotBlank(message = "检索首字母不能为空",groups = {AddGroup.class})
	@Pattern(regexp = "^[a-zA-Z]$",message = "检索首字母必须为一个英文字符",groups = {AddGroup.class,UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull(message = "排序不能为空",groups = {AddGroup.class})
	@Min(value = 0,message = "排序必须为一个大于0的整数",groups = {AddGroup.class,UpdateGroup.class})
	private Integer sort;

}
